package cn.school.servlet;

import cn.school.entity.Student;
import cn.school.service.GradeService;
import cn.school.util.StringUtil;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.UUID;

//渲染 ，展现增加的视图
@WebServlet(name = "ToAddStudentServlet",value = "/toAddStudentServlet")
public class ToAddStudentServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //>>>>req.getMethod().equals("get")

        System.out.println("当前请求方式:"+req.getMethod()+">>>>>>>>>>>");
        super.service(req, resp);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setAttribute("grades",GradeService.INST.findALL());
        request.getRequestDispatcher("/WEB-INF/jsp/student/addStudent.jsp").forward(request,response);
    }
}
